    program clean_util1
      character*90 raw
      character*6 ticker,util
      character*8 date,astid
      character*9 cusip
      character*13 value,units
 !     character*11 util
      dimension ic(5)
!      open(unit=10,file='f:\FIS\H_U1_20131001_20131231.txt')
!      open(unit=98,file='e:\FIS\test.txt')
!      open(unit=99,file='e:\FIS\util_201310_201312.txt')
      open(unit=10,file='e:\FIS\H1_U1_20070101_20070331_rep.txt')
      open(unit=98,file='e:\FIS\test.txt')
      open(unit=99,file='e:\FIS\util_200701_200703_rep.txt')
      i=0
1     i=i+1      
      read(10,1000,end=500)raw
!      write(6,1000)raw
1000  format(a90)
      n=0
      nc=0
3     n=n+1
      if(raw(n:n).ne.'|') go to 3
      nc=nc+1
      ic(nc)=n
      if(nc.lt.5) go to 3
      if(i.eq.1) go to 1
      it1=ic(3)+1
      it2=ic(3)+2
      if(raw(it1:it1).ne.'U') go to 1
      if(raw(it2:it2).ne.'S') go to 1
      astid='        '
      ticker='      '
      date='        '
      cusip='         '
      util='   .00'
      iend=ic(1)-1
      k=9
      do 5 ii=iend,1,-1
          k=k-1
5     astid(k:k)=raw(ii:ii)
      ii1=ic(1)+1
      ii4=ic(1)+4
      ii6=ic(1)+6
      ii7=ic(1)+7
      ii9=ic(1)+9
      ii10=ic(1)+10
      
      date(1:4)=raw(ii1:ii4)
      date(5:6)=raw(ii6:ii7)
      date(7:8)=raw(ii9:ii10)
      ibg=ic(2)+1
      iend=ic(2)+9
      k=0
      do 15 ii=ibg,iend
          k=k+1
15    cusip(k:k)=raw(ii:ii)
      ibg=ic(4)+1
      iend=ic(5)-1
      if(ibg.gt.iend) go to 22
      k=0
      do 20 ii=ibg,iend
          k=k+1
          if(k.gt.6) go to 20
          ticker(k:k)=raw(ii:ii)
20    continue
22    continue
      ibg=ic(5)+1
      m=ic(5)
24    m=m+1
      if(raw(m:m).ne.' ') go to 24
      iend=m-1
      iend2=iend
      id=0
      do 30 ii=ibg,iend
30    if(raw(ii:ii).eq.'.') id=ii
      if(id.eq.0) go to 32
      iend2=id-1
32    k=4
      do 35 ii=iend2,ibg,-1
          k=k-1
35    util(k:k)=raw(ii:ii)
      ibg=id+1
      if(ibg.gt.iend) go to 38
      k=4
      do 37 ii=ibg,iend
          k=k+1
          if(k.gt.6) go to 37
          util(k:k)=raw(ii:ii)
37    continue 
38    continue      
      
100   continue
!      write(6,9900)astid,date,cusip,ticker,contr,loanty,coll,tickets,units,value,age,lavg,lmax,lmin,lstd
!      write(99,9900)astid,date,cusip,ticker,contr,loanty,coll,tickets,units,value,age,lavg,lmax,lmin,lstd
!9900  format(1x,a8,1x,a8,1x,a9,1x,a6,3(1x,a1),1x,a6,1x,a14,1x,a14,5(1x,a11))      
      write(6,9900)astid,date,cusip,ticker,util
      write(99,9900)astid,date,cusip,ticker,util
9900  format(1x,a8,1x,a8,1x,a9,1x,a6,1x,a6)      
!      if(i.lt.10000) go to 1
      go to 1
500   continue      
      stop

    end program clean_util1
